package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.Expect;
import com.red.star.wechat.data.entity.IntentionCardPojo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author: chenjunliang
 * @Description:
 * @Date: 2018/7/18.
 */
public interface IntentionMapper extends MyMapper<Expect> {

    public Expect findExpectByFansId(@Param("fansId")Integer fansId);

    public List<Expect> getExpectList();

    public List<IntentionCardPojo> findIntentionCardPojo(IntentionCardPojo intentionCardPojo);

    public List<IntentionCardPojo> queryIntentionCardByExpectId(IntentionCardPojo intentionCardPojo,@Param("expectId") Integer expectId);

    public List<IntentionCardPojo> findIntentionCardById(@Param("expectId") Integer expectId);

    /**
     * 添加意向卡媒体
     * @param expectId 意向卡ID
     * @param mediaId 媒体ID
     */
    @Insert("INSERT INTO t_expect_media(expect_id, media_id) VALUES(#{expectId}, #{mediaId})")
    void saveExpectMedia(@Param("expectId") Integer expectId, @Param("mediaId") Integer mediaId);

    /**
     * 查询粉丝的所有意向卡
     * @param fansId 粉丝ID
     * @return 意向卡列表
     */
    List<Expect> listExpect(@Param("fansId") Integer fansId);
}
